<template>
  <div>
    <button>苹果10$/斤,折扣8折</button>
    <br />
    请输入你要购买的斤数: <input type="text" v-model.number.lazy="value" />
    <br />
    <button @click="num = value">结账买单</button>
    <br />
    结账单:总价: <span>{{ num * 10 }}元</span> 折后价:
    <span>{{ (num * 10 * 0.8).toFixed(1) }}元</span>省了:
    <span>{{ (num * 10 * 0.2).toFixed(1) }}元</span>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: "",
      num: +0,
    };
  },
};
</script>

<style>
</style>